require 'rubygems'
require 'eventmachine'
require 'singleton'
require 'logger'
require 'facets/core/kernel/with'

require 'network/network_handler'

require 'database/character_database'
require 'database/account_database'

require 'engine/game_engine'


@account_db = AccountDatabase.instance

@@logger = Logger.new('data/log/system.log')


  EventMachine::run {
    host,port = "127.0.0.1", 8090
    EventMachine::start_server host, port, NetworkHandler
    puts "ready..."
    @@logger.info "Now accepting connections on address #{host}, port #{port}..."
    EventMachine::add_periodic_timer( 10 ) { $stderr.write "*" }
  }
  
  @@logger.warn "shutting down server"
  
  
